const express = require('express');
const router = express.Router();
const { registerValidator, loginValidator } = require('../middlewares/validators');
const { register, login, getCurrentUser } = require('../controllers/authController');
const { auth } = require('../middlewares/auth');

// @route   POST /api/auth/register
// @desc    注册用户
// @access  Public
router.post('/register', registerValidator, register);

// @route   POST /api/auth/login
// @desc    用户登录
// @access  Public
router.post('/login', loginValidator, login);

// @route   GET /api/auth/me
// @desc    获取当前用户信息
// @access  Private
router.get('/me', auth, getCurrentUser);

module.exports = router; 